<?php include 'header.php'; ?>
<?php include 'sidebar.php'; ?>
		<div id="gc-pagecontent" class="g-unit" style="position: relative;">
			<h1 class="page_title">Yakexi 框架</h1>
<p>Yakexi 是一个简单的PHP框架，可用来开发适用于Sina App Engine 的 PHP 网络应用程序。</p>
<p>废话少说，直接上"Hello world"</p>
<pre class="prettyprint">
&lt;?php
require 'yakexi/Yakexi.php';
use yakexi as ykx, yakexi\Yakexi;

class MainPage extends ykx\RequestHandler
{
    public function get()
    {
        $this->response->write('Hello World');
    }
}

$application = new Yakexi(array('/.*' => MainPage, True);
$application->run_sae_app();
?&gt;
</pre>
<p>下面的例子演示了使用模板和网址映射。</p>
<pre class="prettyprint">
&lt;?php
require 'yakexi/Yakexi.php';
use yakexi as ykx, yakexi\Yakexi, yakexi\Template;

class BrowseHandler extends ykx\RequestHandler
{
    public function get($category, $product_id)
    {
        // Display product with given ID in the given category.
        $template_values = array(
            'product_id' => $product_id,
            'rate' => 'recommend'
            );
        $path = BASHPATH . "templates/{$category}.html";
        $this->response->write(Template::render($path, $template_values));
    }
    
    public function post($category, $product_id)
    {
        // post to '/browse/(.*)/(.*)'
    }
}

// Map URLs like /browse/(category)/(product_id) to BrowseHandler.
$application = new Yakexi(array('/browse/(.*)/(.*)' => BrowseHandler, True);
$application->run_sae_app();
?&gt;
</pre>
<p>如果你使用过Google App Engine的webapp框架，你会发现Yakexi与webapp异常相似。没错，Yakexi就是完全按照webapp的设计模式打造的PHP框架，<b>目的就是想让python程序员对SAE感觉亲切一点。</b>你没用过webapp也没关系，Yakexi 提供了一种简单的方式来开始开发适用于 App Engine 的应用程序。</p>
<p>框架中的亚克西，SAE中的战斗机。</p>
<p>目前Yakexi的代码和文档还未全部完成...</p>
			<div id="gc-collapsible" style="min-height: 400px;" class=""></div>
		</div>
	</div>
</div>
<?php include 'footer.php'; ?>